package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.GoodsSalesDTO;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.Orders;
import com.sky.vo.SalesTop10ReportVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderMapper {
    //插入订单信息
    void insert(Orders orders);

    //查询历史订单
    Page<Orders> pageQuery(OrdersPageQueryDTO ordersPageQueryDTO);

    //根据订单id查询订单信息
    @Select("select * from sky_take_out.orders where id = #{id}")
    Orders getById(Long id);

    //更新用户状态
    void update(Orders orders);

    //根据状态查询订单数量
    @Select("select count(*) from sky_take_out.orders where status = #{status}")
    Integer countByStatus(Integer toBeConfirmed);

    //根据日期查询营业额
    Double getTurnoverByDate(Map params);

    //统计订单数量
    Integer countByDate(Map params);

    //查询销售TOP10商品
    List<GoodsSalesDTO> getGoodsSalesTop10(LocalDateTime beginTime, LocalDateTime endTime);
}
